﻿@model KPIS.GERP.Models.ICM.MasContact

@{
    ViewBag.Title = "แก้ไขข้อมูล ผู้ขาย";
    ViewBag.Descr = "แก้ไขข้อมูลผู้ขายที่ใช้งานในระบบ";
    Layout = ViewBag.Layout;
    bool noLayout = ViewBag.NoLayout == true;
}

@using (Html.BeginForm("Edit", "MasContact", FormMethod.Post, new { @class = "form-horizontal" ,@id = "form"}))
{
    @Html.AntiForgeryToken()

    <div class="block-button-menu-above">
        @Html.ActionLink("กลับไปหน้าแสดงข้อมูลทั้งหมด", "Index", new { category = Model.ConCategory, noLayout = noLayout }
            , new { @class="btn btn-small btn-gray button-standard-width", role="button" })
        @Html.ButtonSubmit()
        @Html.ButtonCancel(new {id=Model.ConId,category = Model.ConCategory, noLayout = noLayout})
    </div>

    string errormessage = Html.ValidationSummary().ToHtmlString();
    if (errormessage != "<div class=\"validation-summary-valid\" data-valmsg-summary=\"true\"><ul><li style=\"display:none\"></li>"+ @"
</ul></div>")
    {
        <div class="alert-error">@Html.Raw( errormessage)</div>
    }
    @Html.Partial("_EditorForm")
} 

<style>
    .alert-error {
        padding: 10px 10px 10px 10px;
    }
</style>

@section scripts
{
  
    <script>
        $(function () {
            $("#form").submit(function (e) {
                //$("#RegistedCapital").number(false, 2);
                e.preventDefault();
                var currentForm = this;
                //console.log($("#RegistedCapital").number(false, 2));
                bootbox.confirm(function (result) {
                    if (result) {
                        currentForm.submit();
                    }
                });
            });

            $(".chzn-select").chosen({ width: '220px' });
            
            //$("#RegistedCapital").number(true, 2);
            //$.number(5020.2364, 2);
            //console.log($.number(5020.2364, 2));
        });
    </script>
}